package br.edu.unilasalle.simon_api.dao.impl;

import java.util.List;

import javax.persistence.TypedQuery;

import org.springframework.stereotype.Repository;

import br.edu.unilasalle.simon_api.dao.IFuncionarioDao;
import br.edu.unilasalle.simon_api.domain.Funcionario;

@Repository
public class FuncionarioDao extends GenericDao<Funcionario, Long> implements IFuncionarioDao {
	
	public List<Funcionario> findAllFuncionario() {
        StringBuilder str = new StringBuilder();
        str.append("select new Funcionario(o.id, o.nome, o.sobrenome, o.telefone, o.ativo) from Funcionario o ");
        str.append("order by o.nome, o.sobrenome");
        TypedQuery<Funcionario> q = entityManager.createQuery(str.toString(), Funcionario.class);
		return q.getResultList();
    }
	
}
